Issue #1607: Use WriterState instead of implicit parameter