added some more comments, and made delete / close more correct.  Still not working properly