Changed ternary to if. Added comment