refactored database configuration