Changed from print_on/print_atomic_on to a more dynamic depth-based model.
Fixed valgrind problem.