1. Removed unused imports
2. Dryed up the code a bit
3. Added some doc strings
4. Fixed some PEP8 stuff
Removed some debugging code