Refactored if/else statements