adding an event and two function to create table