Comments

Added comments to the code to make it moderately readable.