Refactored redundant if statement