added comments for some clarity