Pushed new switch function from lua-users to functions