Cleaned up database connection and settings