added copious comments