Fix typos.
Refactoring for better understanding