rewrite some of the examples with tests