How to refactor