Change to switch case instead of else if