added shutdown module hook
refactored shutdown handler registration
coding styles fix
Merge pull request #99 from zelgerj/master

refactored shutdown handler registration and added shutdown module hook