Moved connection module from internals

It isn't really internal, but should actually be used by users.