Revert last two commits.

This needs more testing and will be moved to a branch.