Update to handle selected elements as a nested list.
Initial work to hangle inline segments.