added db abstraction