Code Cleanup

Cleaned up the code using StyleCop rules and some suggested R#
suggestions before introducing new features