Adding query functions. Closes #5