Refactoring arrayvalidator