I didn't see a reason this needs to distinguish between null and missing? (Although the algorithms are a bit hard to follow.)