Minor refactor, more tests