simpler code logic and streaming support