Improved example code