Adapted controller to handle connection logic