added code to stop the motor