Implemented  router connection logic