ui tests and refactoring