Nits: Fixed comment typo and refactored duplicate code.
Merge pull request #639 from breck7/patch-1

Fixed comment typo and refactored duplicate code.