Great work. Added some comments.