full sample code