Refactored database configuration