Changed if to switch case