added functions to main switch