Cherry pick changes in DTSegments vis. from nicola's branch.