Allow more forms for query expressions and adding CSV export.

Also adds some documentation to the query screen.
Work on #225
Fixes #228