Added open and close functions