use threads instead of processes