refactors, tests