Got the backtracking implemented correctly.