Added switch case and query