attempt to refactor validator