Add comments and polish code
Merge remote-tracking branch 'origin/master'