add comments, fix exception