Improved Validator, to throw exception when given parameter is typed as string but receives something else