anchor.diff:  	%% @todo iolist_to_binary(HeaderBlock) isn't optimal. Need a shortcut.
   	State = stream_init(State0#state{server_streamid=PromisedStreamID + 2, encode_state=EncodeState},
   		PromisedStreamID, fin, iolist_to_binary(HeaderBlock)),
  -	commands(State, StreamID, Tail);
  +	commands(State, Stream, Tail);
   %% @todo Update the flow control state.
  -commands(State, StreamID, [{flow, _Size}|Tail]) ->
  -	commands(State, StreamID, Tail);
  +commands(State, Stream, [{flow, _Size}|Tail]) ->
  +	commands(State, Stream, Tail);
   %% Supervise a child process.
  -commands(State=#state{children=Children}, StreamID, [{spawn, Pid, _Shutdown}|Tail]) -> %% @todo Shutdown
  -	 commands(State#state{children=[{Pid, StreamID}|Children]}, StreamID, Tail);
  +commands(State=#state{children=Children}, Stream=#stream{id=StreamID},
  +		[{spawn, Pid, _Shutdown}|Tail]) -> %% @todo Shutdown
  +	 commands(State#state{children=[{Pid, StreamID}|Children]}, Stream, Tail);
   %% Error handling.
  -commands(State, StreamID, [Error = {internal_error, _, _}|Tail]) ->
  +commands(State, Stream=#stream{id=StreamID}, [Error = {internal_error, _, _}|_Tail]) ->
  +	%% @todo Do we want to run the commands after an internal_error?
  +	%% @todo Do we even allow commands after?
   	%% @todo Only reset when the stream still exists.
  -	commands(stream_reset(State, StreamID, Error), StreamID, Tail);
  +	stream_reset(after_commands(State, Stream), StreamID, Error);
   %% Upgrade to a new protocol.
   %%
   %% @todo Implementation.
   %% @todo Can only upgrade if: there are no other streams and there are no children left alive.
   %% @todo For HTTP/1.1 we should reject upgrading if pipelining is used.
  -commands(State, StreamID, [{upgrade, _Mod, _ModState}]) ->
  -	commands(State, StreamID, []);
  -commands(State, StreamID, [{upgrade, _Mod, _ModState}|Tail]) ->
  +commands(State, Stream, [{upgrade, _Mod, _ModState}]) ->
  +	commands(State, Stream, []);
  +commands(State, Stream, [{upgrade, _Mod, _ModState}|Tail]) ->
   	%% @todo This is an error. Not sure what to do here yet.
  -	commands(State, StreamID, Tail);
  -commands(State, StreamID, [stop|_Tail]) ->
  +	commands(State, Stream, Tail);
  +commands(State, Stream=#stream{id=StreamID}, [stop|_Tail]) ->
   	%% @todo Do we want to run the commands after a stop?
  -	stream_terminate(State, StreamID, normal).
  +	%% @todo Do we even allow commands after?
  +	stream_terminate(after_commands(State, Stream), StreamID, normal).
  +
  +after_commands(State=#state{streams=Streams0}, Stream=#stream{id=StreamID}) ->
  +	Streams = lists:keystore(StreamID, #stream.id, Streams0, Stream),
  +	State#state{streams=Streams}.
   
   terminate(#state{socket=Socket, transport=Transport, handler=Handler,
   		streams=Streams, children=Children}, Reason) ->
  
positive.code: %% split into multiple calls and flow control should be used to make
  %% sure we only send as fast as the client can receive and don't block
  %% anything.
  commands(State=#state{socket=Socket, transport=Transport}, StreamID,
  		[{data, IsFin, Data}|Tail]) ->
  	Transport:send(Socket, cow_http2:data(StreamID, IsFin, Data)),
  	commands(State, StreamID, Tail);
  %% Send a file.
  %%
  %% @todo This implementation is terrible. A good implementation would
  
negative.code: 	Transport:send(Socket, cow_http2:rst_stream(StreamID, Reason)),
  	stream_terminate(State, StreamID, StreamError).
  
  stream_terminate(State=#state{socket=Socket, transport=Transport, handler=Handler,
  		streams=Streams0, children=Children0, encode_state=EncodeState0}, StreamID, Reason) ->
  	case lists:keytake(StreamID, #stream.id, Streams0) of
  		{value, #stream{state=StreamState, local=idle}, Streams} when Reason =:= normal ->
  			Headers = #{<<":status">> => <<"204">>},
  			{HeaderBlock, EncodeState} = headers_encode(Headers, EncodeState0),
  			Transport:send(Socket, cow_http2:headers(StreamID, fin, HeaderBlock)),
  			stream_call_terminate(StreamID, Reason, Handler, StreamState),
  			Children = stream_terminate_children(Children0, StreamID, []),
  			State#state{streams=Streams, children=Children, encode_state=EncodeState};
  		{value, #stream{state=StreamState, local=nofin}, Streams} when Reason =:= normal ->
  			Transport:send(Socket, cow_http2:data(StreamID, fin, <<>>)),
  			stream_call_terminate(StreamID, Reason, Handler, StreamState),
  