improve example code