added comments for clarification purposes on added part of code