added delete and insert events code