minor tweaks, cleanup and pep8ification