Stream encoding exercise