added comments to make less confusing