Added a handle events function as I see the sense in it.