Refactor for test