renderUI refactored