Adding Comments

added comments and imporved the lay out of the code