Tweaking the sort order to get everything to nest correctly.