added support for switching levels