Fixed some typos and update the code with some docs.

Sorry for asking the second time to merge this and thanks.