Added method to switch connection