updated db and query functions
Merge pull request #1 from asb-school/gaynor

updated db and query functions