Converted if-else-if... to switch statement