     yTicksRemaining = accelTab[yAccelStep];
     
     if (yPosition < yTarget) {
-      SET_Y_DIR();
+      FORWARD_Y();
       if (yPosition < SAFE_LIMIT) {
         ++yPosition;
         STEP_Y();
       }
     } else if (yPosition > yTarget) {
-      CLR_Y_DIR();
+      BACKWARD_Y();
       if (!AT_Y_MIN()) {
         --yPosition;
         STEP_Y();

  Serial.begin(9600);
}

volatile uint16_t xPosition = 0;
volatile uint16_t yPosition = 0;
volatile uint16_t zPosition = 0;
volatile uint16_t xTarget = 0;
volatile uint16_t yTarget = 0;
volatile uint16_t zTarget = 0;

// Table approximates a square root function (at constant acceleration, elapsed time goes as square root of distance).
// Acceleration increases towards the far end (non-linear), so that we reach max speed in a reasonable time.

    zTicksRemaining = accelTab[zAccelStep];
    
    if (zPosition < zTarget) {
      FORWARD_Z();
      if (zPosition < SAFE_LIMIT) {
        ++zPosition;
        STEP_Z();
      }
    } else if (zPosition > zTarget) {
      BACKWARD_Z();
      if (!AT_Z_MIN()) {
        --zPosition;
        STEP_Z();
