Support connect at the top level by avoiding code duplication