added comments explaining a bit