small refactoring to an examples namespace; unit tests of the examples; coercion to match input types