Code Cleanup: database autoconnect