updated the sample code