An implementation of Srinivasan and Ruina, 2006.