revise sample code