Change switch to a simple if