big code cleanup (applied PEP 8 rules to the code, some other refactoring). To be continued... (Probably tomorrow)