refactor for test