clean up db logic