Partial implementation of passing db in place of dbstruct to enable transactions