More flexible connection factory