Added a main, added comments to ease the way for the less experimented ones, added legends.