some changes presumably from Hinrik