Hi Tim. I discover hourly some little implementation fixes here and there. I use working with very nice results with the moodle tracker module I redesigned from Tham Clifford.
This would be just a suggestion to you but using this tracker (this one is simple enough for fast setup, but sure is not the Graal either !!) helps a lot in reporting code issues to you so you can manage efficiently when and how to consider them.
This is a full Moodle module and is available here.
Can see it in action here.
I patched the fixed string in avedit.xsl bringing additional string out from /lang/xx_utf8/autoview.php.
Cheers.