added db handleing