some pep 8 fixes and code cleanup