Bug fixes galore.
Also typo fixes.