Refactored one if condition