Adding some comments, etc, after merging with paul's version.