lots of refactoring.
test refactoring
tests
more tests