improve timing of show/hide events