Database functions extended