Added option to return query result as array (not object)