more porting, the work on depth-based headings is provisional, I may need to just implement it as a final recursive pass-through