Refactored isvalid test to be more imperative and remove confusing data provider workarounds.