oops missing parens makes for order of operations error, fixed selection of query type