Cleaned up code.

Removed unused variables/classes/imports and added comments.