Refactoring and fix typo.