anchor.diff:  					Log = case erlastic_search:index_doc(?ES_INDEX,
   														 "vsdatapoint", Msg) of
   						  	{error, _Reason} ->
  -						  		NewLastUpdated = State#state.last_updated,
  -						  		NewHistorySize = State#state.history_size,
  +						  		NewLastUpdated = State#vsstate.last_updated,
  +						  		NewHistorySize = State#vsstate.history_size,
   						  		%% TODO Persistent storage using file?
  -								[Msg | State#state.log];
  +								[Msg | State#vsstate.log];
   							{ok, _} ->
   								NewLastUpdated = Timestamp,
   								%% Try updating the vstream and storing the log
  -								{L, S} = store_log_in_es(State#state.log, 0),
  -								NewHistorySize = State#state.history_size + S + 1,
  -								update_virtual_stream(State#state.vstreamid,
  +								{L, S} = store_log_in_es(State#vsstate.log, 0),
  +								NewHistorySize = State#vsstate.history_size + S + 1,
  +								update_virtual_stream(State#vsstate.vstreamid,
   													  NewHistorySize,
   													  NewLastUpdated),
   								L
  
positive.code: 
  
  
  %% spec of record state:
  %% {string(), [{atom(),string()}], binary(), {pid(), pid(), pid()}, atom()}
  -record(state, {vstreamid, datapoints, exchange, network, function, log, history_size, last_updated}).
  
  
  
  
negative.code: 									Time -> binary_to_list(Time)
  								end,
  							%% Create state
  							State = #vsstate{vstreamid=VStreamId,
  										     datapoints = DataPoints,
  										     exchange = VStreamExchange,
  										     network = {Connection, ChannelIn, ChannelOut},
  										     function = Function,
  										     log = [],
  										     history_size = HistorySize,
  										     last_updated = LastUpdated},
  						    {ok, State}
  					end
  			end
  