Typos + a bit of refactoring.