removed backtrack when not necessary