       currentTick[16]=0;
     }
   }
-  
+
 }
 
 void togglePin(byte pin, byte direction_pin) {
-  
+
   //Switch directions if end has been reached
   if (currentPosition[pin] >= MAX_POSITION[pin]) {
     currentState[direction_pin] = HIGH;

    }
    delay(5);
  }
  
  for (byte p=FIRST_PIN;p<=PIN_MAX;p+=2){
    currentPosition[p] = 0; // We're reset.
    digitalWrite(p+1,LOW);
    currentState[p+1] = 0; // Ready to go forward.
  }
  
}





/*
Called by the timer inturrupt at the specified resolution.
 */
void tick()
{
  /* 
   If there is a period set for control pin 2, count the number of
   ticks that pass, and toggle the pin if the current period is reached.
   */
  if (currentPeriod[2]>0){
    currentTick[2]++;
    if (currentTick[2] >= currentPeriod[2]){
