added secondary booleans to open and close callback