Added events and moved convenience functions to cleanup.py. New tests for events