added some comments to explain my work