Changed if to switch