     #define SERIAL_BUFFER_SIZE 64
 #endif
 
-struct Frame {
-  uint16_t transitionTime;
-  uint16_t pauseTime;
-  uint8_t colorStopCount;  
-
-};
-
 struct ColorStop {
   uint16_t ledIndex;
   uint8_t r;
   uint8_t g;
   uint8_t b;
-
+  
 };
 
-Adafruit_NeoPixel* strip       = NULL;
-struct Frame* currentFrame     = NULL;
-struct ColorStop** colorStops = NULL;
+struct Frame {
+  uint16_t transitionTime;
+  uint16_t pauseTime;
+  uint8_t colorStopCount;  
+
+};
+
+Adafruit_NeoPixel* strip = NULL;
 uint8_t currentFrameIndex = 0;
-uint8_t* startR;
-uint8_t* startG;
-uint8_t* startB;
-uint8_t* stepR;
-uint8_t* stepG;
-uint8_t* stepB;
+uint8_t* startR = NULL;
+uint8_t* startG = NULL;
+uint8_t* startB = NULL;
+uint8_t* stepR = NULL;
+uint8_t* stepG = NULL;
+uint8_t* stepB = NULL;
 uint16_t stepsUntilNextFrame = 0;
 
 void setup() {

  //show the gradient
  strip->setBrightness(64);
  strip->show();
  
  //Create arrays
  startR = (uint8_t*) malloc(ledCount);
  startG = (uint8_t*) malloc(ledCount);
  startB = (uint8_t*) malloc(ledCount);
  stepR = (uint8_t*) malloc(ledCount);
  stepG = (uint8_t*) malloc(ledCount);
  stepB = (uint8_t*) malloc(ledCount);

  //Load current profile
  applyProfile();


void applyProfile() {
  currentFrameIndex = 0;
  loadNextAnimationStep();

}

void loadNextAnimationStep() {
  //increase frame
  currentFrameIndex++;
  
  //Free arrays to gain RAM
  if(stepR != NULL) {
    free(stepR);
    free(stepG);
    free(stepB);
    
  }

  //Load current Frame;  
  struct Frame* frame = NULL;
  struct ColorStop** colorStops = NULL;
  loadFrame(0, &frame, &colorStops);
  
  /*
  Serial.println("-------------------");
  Serial.print("colorStopCount: ");
  Serial.println(frame->colorStopCount);
  Serial.print("transitionTime: ");
  Serial.println(frame->transitionTime);
  Serial.print("pauseTime: ");
  Serial.println(frame->pauseTime);
  Serial.print("colorStops[0]->ledIndex: ");
  Serial.println(colorStops[0]->ledIndex);
  Serial.print("firstColorStop->r: ");
  Serial.println(colorStops[0]->r);
  Serial.print("firstColorStop->g: ");
  Serial.println(colorStops[0]->g);
  Serial.print("firstColorStop->b: ");
  Serial.println(colorStops[0]->b);
  Serial.print("colorStops[1]->ledIndex: ");
  Serial.println(colorStops[1]->ledIndex);
  Serial.print("firstColorStop->r: ");
  Serial.println(colorStops[1]->r);
  Serial.print("firstColorStop->g: ");
  Serial.println(colorStops[1]->g);
  Serial.print("firstColorStop->b: ");
  Serial.println(colorStops[1]->b);
  */
  
}

void loadFrame(uint8_t index, struct Frame** framePointer, struct ColorStop*** colorStopsPointer) {
  uint8_t i;

  //If there is no frame at the pointed address, override create a new one and save it to the pointer
  if(*framePointer == NULL) {
    *framePointer = (struct Frame*) malloc(sizeof(struct Frame));
    (*framePointer)->colorStopCount = 0;
  
  }
 
  //Save simple pointer to frame
  struct Frame* frame = *framePointer;

  //Init Frame address with the porfile start
  uint16_t frameAddress = EEPROM_CURRENT_PROFILE_START;

  //Iterate over all Frames until the desired one
  for(i=0; i<index; i++) {
    //Read how many ColorStops the Frame contains and multiply it by the size of one ColorStop, add it to Address
