Updated activate_core(...) to use doParallel