edited the sample code