Some code cleanup and comments
Merge remote-tracking branch 'origin/master'