     for (int i=0; i<glisssteps; i++) {
         onestep(map(i, 0, glisssteps, startpulse, endpulse));
     }
-    for (int i=0; i<(accelSteps - (decelDiff * recentre)); i++) {
+    for (int i=0; i<accelSteps; i++) {
         onestep(map(i, 0, accelSteps, endpulse, max(maxPulse, endpulse)));
+        if (i>(accelSteps - (decelLook * recentre) && digitalRead(sensorPin))) break;
     }
     if (recentre) findsensor(max(maxPulse, endpulse));
     digitalWrite(LED_BUILTIN, LOW);


// speeds
#define pulseWidth      5
#define accelSteps     90
#define decelDiff      10 // shorten decel to be sure of finding sensor
#define halfTurnSteps 200 // steps for a half turn
#define minPulse      500
#define maxPulse     2300
#define durationGlissCompensation 480

    for (int i=0; i<fullspeedsteps; i++) {
        onestep(pulse);
    }
    for (int i=0; i<accelSteps; i++) {
        onestep(map(i, 0, accelSteps, pulse, startstoppulse));
        if (i>(accelSteps - decelLook) && digitalRead(sensorPin)) break;
    }
    findsensor(startstoppulse);
    digitalWrite(LED_BUILTIN, LOW);
