Fix typo and clean-up/refactoring