added lots of comments and made it more generic
Merge branch 'commenting'