Refactor if