--Changed for parallel calculation