Add a thread for better perf and little cleaning