Got next states to almost 100% work. It is only slightly off in a case in example 3 of the PDF.