simpler event code for better close/hide behavior