Cleanup and debugging
* Meets PEP8, except for some comma spacing
* Minor bugs affecting the debugging code