updated for a safe stop