Added comments for clarification on various functions