Added switching functionality