Excellent writeup. It&#x27;s a very useful example of a refactor done right. I&#x27;d love to know more about the json interface between the Python and OCaml code, since &quot;integration&quot; is usually where refactors like this get hard.