Code Cleanup and commentary added.