Minor refactoring (if statement optimized)