Move ui code into new ui.py file