this should do it and not have to resort to using isvalid.