added main thread, added ui.