Added code for kill switch and simulation mode.
refactoring
Refactoring
Refactoring continues