Speed increased by using pragma parallel for