Fixed error which was using wrong id for comparison

Also made some attempts to fix incorrect ordering of
events.
Merge branch 'initial-development' of http://github.com/wilseypa/warped2 into initial-development