Reintroduce the concept of depth as a secondary sort key.