Adding ui update handler, because secondary threads cannot update the UI directly.