Cleaned up database connector