Ported traverse_pt() to XS