lookupRef and resolveRef now return Maybe types