Changed the output to use events