Sorting out query duplication method replacement logic.  Might be a little trickier than originally intended