Fixed a lot of PEP8 and flake8 errors
Lots of imported but not used are fixed
Lots syntax styling fixed