shorten the if-else to keep the code neat