Split ratchet algorithm out to a separate section. Also clean up some phrasing and correct a typo or two.