refactor validator for extensibility