Refactoring UI class