added database query functions