Code as received from Ilan.