Minor refactoring and typo fixes
Merge remote-tracking branch 'origin/master'