adds removeQuery and changes refs