Improve example with validation