add events module and add threading.local for events