added better comments to the code