Added hide and show commands to the event handler