now using in-memory database
refactoring