Applied PEP8 guidelines to codebase

- Removed various unused imports
- Tidied up whitespace
- Fixed indents & line lengths.