Vastly improved get_boxed_structure.