Refactored database manager