Original code base for Wang Schmidler 2014