Simplify cert check; TODO - can we do better?