adding Backtrack implementation