Refactoring into ui class