code cleanup and PEP8