Random number of bug fixes for small test failures.
Remove ‘ui’ module completely, salvage some caching code.