Removed unused code and solved PEP8 issues