refactor pattern