added some comments to explain collision handling