Convert simple example to use events