add comments and fix some typos