Until I can get a way to present this more properly, you can see my code (and cut and paste if you want) here:
http://members.bex.net/johnnymcc
There is no documentation yet since I can't get LPDoc to work. Sorry.
There will be a better way to get this before too long.
John