finished new connection function