Inverted the if-else statement
Comment added