Corrected some bugs with events.
Updated rakefile to run unit tests.
Added basic tests for events.