refactored UI code preparing for multiple app modes