C code from DeAngelis and Marcello (2013)