Added switch case

added switch case and functions.