example code updated to new event paradigm