Updated comments and added extra assertions.
Minor typo fixes in comments.