finished summarize_tree for shell and ruby