Tidy up example.
Validate parameters.