added comments to clarify things