Changed if else to switch