move event handlers to bottom