+ added comments to clarify the code