adds event handler