now works with db