updated open and close callbacks to take data