Revert "Revert "Revert "cleaned database connect"""

This reverts commit 6d09994fdd33018261725115a7dce841c070cbd6.