updated sample code.