Latest so far.

Latest code in comments.