Typo corrections and code tidy up.