added parameters for querying, #11

sort_by, sort_direction
output, output_filename