updated code to new db abstraction