Made some changes to the sample code.