Merged the improvements by Harry Binnema