Refactor testing