Do you really need a fourth traversal here? This is going to significantly regress layout performance. Can you do this during some other pass?