Numerous bug fixes.
Version bump.