Fixed lot of UI code. Now very basic UI is rendered correctly.