adding events when items are added and removed