Refactor. Removed some unused code and comments. Cleanup some whitespace.