Cleanup of code, comments.

Added comments to key methods