Add lots of testing
Refactor to simplify testing