Round 1 of total refactor, all tests pass