Added and refined comments.  Finalized code.