Nits: Fixed comment typo and refactored duplicate code.