Connection routine factored out into separate package