Multiple refactorings
(and fixing typos)