Added open and close events