Added timeout functionality to running commands

- removed some needless #defines
Removed more preprocessor crap