Refactored createUI