refactoring the UI layer