Added more comments for clarification.