Refactorings: when instead of if, require instead of use