edited script to grab event data