Building queries

Finished basic queries, for optional searches.