add function for switching