if-else changed to switch