 {
   while(angle < 0)
   {
+    // make positive
     angle += 360;
   }
+  // make within range 0 - 360
   desiredDegrees = angle % 360;
+  
   // Step = Degrees / steps per degree * gear ratio
-  desiredStep = int(desiredDegrees/stepDegree)*19;
+  desiredStep = long(desiredDegrees/stepDegree)*19;
+  long tempval = desiredStep - stepCount;
+  Serial.println("recalculating");
   if(stepCount == desiredStep)
   {
     return;
   }
-  else if ((abs(desiredStep - stepCount) < int(180/stepDegree)*19 ) || 
-  ((desiredStep + MAX_STEP_VALUE - stepCount) < 180) )
+  // move intelligently...
+  else if (((tempval > 0) && ((tempval) < (long(180/stepDegree*19))) ) || 
+  ((desiredStep + MAX_STEP_VALUE - stepCount) < (long(180/stepDegree*19))) )
   {
     driveUp();
   }

    nh.subscribe(cvDegreeReader);
    nh.advertise(cvDegreePublisher);
  } else {
    Serial.begin(9600);
  }
}

void loop()
{
  if (USE_ROS) {
    nh.spinOnce();
  } else {
    if(Serial.available())
    {
      rotateToFaceAngle(Serial.parseInt());
    }
  }
  

    delayMicroseconds(DELAY);
    digitalWrite(PULSE_PIN, LOW);
    stepCount = (stepCount + 1) % MAX_STEP_VALUE;
    Serial.print("Step Count:");
    Serial.print(stepCount);
    Serial.print(" | Target Step:");
    Serial.println(desiredStep);
  }
}

