Fixed Typo and refactor