remove redundant nesting during content transformation