Port of David de Marneffe's GERG2004 implementation.