WIP: overhaul
WIP: tests pass, time to refactor
WIP: refactoring