Handle UI and input in separate threads