code clean up and PEP8 compliance