generalized escape fraction code