udated parallel algo