Added backtracking.