Typos
Minor refactoring