hooked up event processing to the public api, rewrote the demo to use only the public api, added an example lua script