Added some comments
Restructured, added explanations