added the stop function