optimized threads, still noisy and slow, because writing to file is done with only main one