wip: fix typo
wip: more tests and refactoring