Major refactoring of UI