Finished rudimentary query api