Alternative delong.placements code, courtesy of Kazuki Yoshida.