Fixed two bugs and added comments to the code.