Little refactor, more tests