added opened, closed events and destroy method to retrieve original DOM state