added open/close implementation