untested and definitely buggy, but example code compiles now --KW