cleanup tests, fixed bugs and added support for python 3