Added the events functionality