removed unnecessary factories
implemented connection including closure