Numerous changes and fixes.