 }    
 
 void discSlipCheck(){
-    if (rpm < (DESIREDRPM_TABLE - ROTATIONVARIANCE)){
+    if (rpm < ((DESIREDRPM_TABLE - ROTATIONVARIANCE) && (allStopVar == 0))){
         discSlipPrecond++;
         }
     else
-        if (discSlipPrecond > 0){
+        if (discSlipPrecond > 0 && allStopVar == 0){
         discSlipPrecond--;
         }
     if (discSlipPrecond > DISCSLIPCOUNT){
-    client.publish(TOPIC_T, "Error: - Continuious Disc Slip Detected"); 
+	Serial.println("Continious disc slip detected");
+    client.publish(TOPIC_T, "Error: - Continuious Disc Slip Detected");
+	discSlipPrecond = 0;
     }
 }
 
 
 void lockedRotorCheck(){
     if (rpm <= LOCKEDDISCRPM){
+		Serial.println("Locked rotor. attempting restart");
         digitalWrite(STARTRELAYPIN, LOW); // immediately shut down if RPM lowByte
-        }                            
-        client.publish(TOPIC_T, "CritErr: Disc rotation is locked, attempting restart");              
+        client.publish(TOPIC_T, "CritErr: Disc rotation is locked, attempting restart");
+		delay(STOPTIME);
+		motionControlStart();
+		}                            	
 }
 
 void allStop(){

  }

void motionControlStart(){
    Serial.println("Motor Control Start");
    if (restartCount < NUMBEROFRESTARTS){
        digitalWrite(STARTRELAYPIN, HIGH); // enable start relay if not above fail counter
        delay(5000); // wait for 2 second for a rotation 
        if (pulseCount == 0){               // if no rotation detected in interrupt
            digitalWrite(STARTRELAYPIN, LOW); // turn off motor becuase of no rotation
			Serial.println("No rotation detected -- attempting restart");
            restartCount++;
            delay (3000); // delay 3 seconds before attempting restart
            pulseCount = 0; // reset pulse count 
            motionControlStart();
            }
        if (pulseCount > 1){
        Serial.println("motion started, system running");
		delay(3000); 	// wait 3 seconds for disc to come up to fast enough speed
						// to not trip locked rotor functiion
		pulseCount = 0;
        restartCount = 0; // set restart counter to 0, since we're started
        allStopVar = 0; // Set allstop condition to off 
        }

if  (allStopVar == 0){
    calculateRPM();
    discSlipCheck();
    lockedRotorCheck();
}
    //now = millis();
    //MQTT Connection Check
