refactored all the things, switched to py.test