Changed if for switch