refactoring to use db rather than csv datastore