lots of refactoring in tests