upated example code