adding comments and a bug fix