Replace concurrent.futures with own implementation of thread_map