Heavy refactor, first test.