refactor testing