   power_spi_disable();
 }
 
-void setMotorToTurn() {
-    pinMode(MOTOR_INPUT1_PIN, OUTPUT);
-    pinMode(MOTOR_INPUT2_PIN, OUTPUT);
-    pinMode(MOTOR_INPUT3_PIN, OUTPUT);
-    pinMode(MOTOR_INPUT4_PIN, OUTPUT);
-
-    pinMode(MOTOR_ENABLE12_PIN, OUTPUT);
-    pinMode(MOTOR_ENABLE34_PIN, OUTPUT);
-    digitalWrite(MOTOR_ENABLE12_PIN, HIGH);
-    digitalWrite(MOTOR_ENABLE34_PIN, HIGH);
-}
-
-void setMotorToSleep() 
-{
-    digitalWrite(MOTOR_ENABLE12_PIN, LOW);
-    digitalWrite(MOTOR_ENABLE34_PIN, LOW);  
-
-    pinMode(MOTOR_INPUT1_PIN, INPUT_PULLUP);
-    pinMode(MOTOR_INPUT2_PIN, INPUT_PULLUP);
-    pinMode(MOTOR_INPUT3_PIN, INPUT_PULLUP);
-    pinMode(MOTOR_INPUT4_PIN, INPUT_PULLUP);
-}
-
 void setup()
 {
+
   // make all unused pins inputs with pullups enabled by default, lowest power drain
   // leave pins 0 & 1 (Arduino RX and TX) as they are
   for (byte i=2; i <= 20; i++) {    

    dataFile.println(F("Time,Pellet Count,Pellet Drop Delay"));
    dataFile.close();
  }

  motor.setSpeed(35);
  setMotorToTurn();

  delay (500);
  
  // get ready for what the system should be doing
  PIState = digitalRead(PIPin);
  lastState = 0;
  
}

void loop()
{
  PIState = digitalRead(PIPin);
  Serial.print("Photointerrupter State: ");
  Serial.println(PIState);
  digitalWrite(TTL, LOW);

  if (PIState == 1  & PIState != lastState) {
    setMotorToTurn();
  
    digitalWrite(TTL, HIGH);
    delay(50);
    digitalWrite(MOTOR_INPUT1_PIN, HIGH);
    digitalWrite(MOTOR_INPUT2_PIN, HIGH);
    digitalWrite(MOTOR_INPUT3_PIN, HIGH);
    digitalWrite(MOTOR_INPUT4_PIN, HIGH);
    startTime = millis();
    Serial.print(F("Time Elapsed Check: "));
    Serial.println(timeElapsed);

    pelletCount ++;
    Serial.println(F("It did work"));
    clearDisplay();
    delay(2); // allow a very short delay for display response
    setDisplayValues(pelletCount);
    lastState = PIState;
  }
  else if (PIState == 1) {
    Serial.println(F("Turning motor..."));
    power_twi_enable();
    gPtrToStepper->step(STEPS_TO_INCREMENT/2,FORWARD,DOUBLE);
    gPtrToStepper->step(STEPS_TO_INCREMENT,BACKWARD,DOUBLE);
    gPtrToStepper->release();
    power_twi_disable();
    lastState = PIState;
  }
  
