Use switch instead of chained if