Add isValid()

See issue #13