small modification of the sample code