updated sample code to remove boiler plate