use thread to offload work, so UI will not hang