Rewrite test to use simpler materialize
Put all detail in the same place
Add support for optional as a sequence