Updated if-else to be more understandable