annotated the code, to make ready for publication