Refactor connect.router segment