add thread and retry support