since validID is true if and only if result is non-nil, we could factor it out.