refactor and simplify tests