Cleaned up some parts of the code and fixed indendation issues
Added a call to close() on shutdown
Merge pull request #20 from heffebaycay/feature/cleanup

Feature/cleanup