Made the UI work again after restructuring the code