Replaced If statement with conditional operator