Updated example code for callbacks