Added event generation for trial -- really messy, but it does the job