add some comments for clarification in the code and writeup