more db logic