Further performance improvements and fixes.