Fix typos in docs
Minor refactoring