Tweaked sample code