Working on python2, does not shutdown gracefully
Improved error handling, interrupt handling.