Fixed most pep8 errors and removed unused imports