DatabaseManager refactored