Changed 'if' to 'switch case' statements