updated sample code and documentation