Fixed a bug with queries accepting whitespace.

Also added some tentative documentation to the Query class.