Code cleanup and PEP 8-ification