a bunch of refactoring, but now failed tests