ENH Update code to match paper exactly