partial revisions. still need to complete
begin redefine p as probability of remaining open