Refactored if statements