Cleaned up formatting and comments
Cleanup and optimization