some comments, and minor code changes