getting basic query functions working