New event handling internal lib to order events. Replaced patch lib. New interface for test (by joppu)