UI optimization to eliminate flickering