added switch case function