Adding emergency stop code