 
     logData();
     updateDisplay();
+    justMoved[inputNum] = false;
   }
   else if (PIStates[inputNum] == 1) {
     //need to replace pellet
-    Serial.print(F("Replacing pellet #"));
-    Serial.print(String(inputNum + 1));
-    Serial.println(F("..."));
-    moveMotor(inputNum);
-    delay(500);
+    if (!justMoved[inputNum]) {
+      Serial.print(F("Replacing pellet #"));
+      Serial.print(String(inputNum + 1));
+      Serial.println(F("..."));
+      moveMotor(inputNum);
+      justMoved[inputNum] = true;
+    }
+    else
+    { delay(500); justMoved[inputNum] = false; }
   }
   
   else if (PIStates[inputNum] == 0 & PIStates[inputNum] != lastStates[inputNum]) {


void enterSleep()
{
  power_usart0_disable(); //Serial (USART)
  sleep_enable();


    Serial.print(F("Pellet #"));
    Serial.print(String(inputNum + 1));
    Serial.println(F(" replaced"));
    justMoved[inputNum] = false;
  }
  
  else  { //if PIStates == 0
    //pellet still there, do nothing
    lastStates[inputNum] = PIStates[inputNum];
    justMoved[inputNum] = false;
    return false;
  }
  lastStates[inputNum] = PIStates[inputNum];
