added comments to try and understand