add isValid method