Some refactoring and remove UI stress test.