Mathematica 7 / 8 compatibility.
Annotated code.