refactoring the whole db thing to fit into the idiomatic datomic pattern