Clean up check_tree a bit.