added comments to explain shit