modifying to trace, still not done
modifying to trace that prints the grids of the solution(if any)