     }
     for (int i=0; i<decelsteps; i++) {
         oneStep(map(i, 0, decelsteps, endpulse, max(maxPulse, endpulse)));
-        if (i>(accelSteps - decelLook) && digitalRead(sensorPin)) break;
+        if (i>(accelSteps - decelLook) && digitalRead(sensorPin)) return;
         if (alarmState) return;
     }
     findSensor(max(maxPulse, endpulse));

    }
    for (int i=0; i<accelSteps; i++) {
        oneStep(map(i, 0, accelSteps, pulse, startstoppulse));
        if (i>(accelSteps - decelLook) && digitalRead(sensorPin)) break;
        if (alarmState) return;
    }
    findSensor(startstoppulse);

    }
    for (int i=0; i<accelsteps; i++) {
        oneStep(map(i, 0, accelsteps, pulse, startstoppulse));
        if (alarmState) return;
    }
}
