sample 21: implement callback handling