refactor valid example