Added some of the events code, more to come.