Comments and code cleanup

Code cleanup and comments added through out.
Whitespace cleanup

Mixed spaces and tabs were being used. Everything is now using tabs.