replace if statement to switch