added command_stream struct and completed read_command_stream