refactoring
valid no longer returns false if duplicate 0s