Added recursive backtracking