Refactor kill_switch function into own module to allow time-based unit testing without Proces.sleep call.