separate thread to update UI