Factor out connection pooling