refactored classes for in-memory database management.