Annotated & minor formatting to code.