Minor changes, plus more comments to the code.