Added comments to help with under standing the code