Clean up and fix for deprecated connection