Cleaned

Cleaned up the code. Removed all unused imports and variables. Wrote more detailed comments