add queryRangeRec helper function to avoid concatenating return values and speed up queryRange function
update version of module
simplify conditional logic in queryRange