added some comments, and helping get Jonathan's version on track