Changed to switch instead of if