make IsOpen a function