updated sample code to use only pointers