Some changes by Mats.