modifiy primerquery to treat forward and reverse separately