use "multicore" package and mclapply