adds event handlers