code cleanup, PEP8, changed from nosetests to py.test