Split NewQuery function