Flip ui refactoring