more self-contained example (with checked output)