Refactored UI and split logic and ui elements.