Added explanations in comments