anchor.diff:  postcondition(S, {call,?DRIVER,range_query,[StreamName,Start,End]}, Result) ->
       case Start > End of
           true ->
  -            Result =:= [];
  +            Expected = [];
           false ->
               case lists:keysearch(StreamName,1,S#state.streams) of
                   {value, {StreamName,Data}} ->
  -                    Expected = lists:sort([Y || {X,Y} <- Data, X>=Start, X=<End]),
  -                    Observed = lists:sort([Y || {_,Y} <- Result]),
  -                    Observed =:= Expected;
  +                    Expected = lists:reverse([Y || {X,Y} <- Data, X>=Start, X=<End]);
                   false ->
  -                    Result =:= []
  +                    Expected = []
               end
  -    end;
  +    end,
  +    Observed = [Y || {_,Y} <- Result],
  +    io:format("~nIn range_query: ~n",[]),
  +    io:format("Expected: ~p~n",[Expected]),
  +    io:format("Observed: ~p~n~n",[Observed]),
  +    Expected =:= Observed;
   postcondition(S, {call,?DRIVER,all_since,[StreamName,TS]}, Result) ->
       case lists:keysearch(StreamName,1,S#state.streams) of
           {value, {StreamName,Data}} ->
  -            Expected = [Y || {X,Y} <- Data, X>=TS];
  +            Expected = lists:reverse([Y || {X,Y} <- Data, X>=TS]);
           false ->
               Expected = []
       end,
       Observed = [Y || {_,Y} <- Result],
  -    is_subset(Expected, Observed);
  +    io:format("~nIn all_since: ~n",[]),
  +    io:format("Expected: ~p~n",[Expected]),
  +    io:format("Observed: ~p~n~n",[Observed]),
  +    Expected =:= Observed;
   postcondition(S, {call,?DRIVER,last_entry_at,[StreamName,TS]}, Result) ->
       case lists:keysearch(StreamName,1,S#state.streams) of
           {value, {StreamName,Data}} ->
  -            io:format("~n[Y || {X,Y} <- Data]: ~p~n",[[Y || {X,Y} <- Data]]),%, X=<TS]]),
  -            io:format("Result: ~p~n~n",[Result]),
  -            true;
  -%            lists:member(element(2,lists:nth(1,Result)), [Y || {X,Y} <- Data, X=<TS]);
  +            Smaller = [{X,Y} || {X,Y} <- Data, X=<TS],
  +            case Smaller of
  +                [] ->
  +                    true;
  +                _ ->
  +                    {_,Expected} = lists:last(lists:keysort(1,Smaller)),
  +                    [{_,Observed}] = Result,
  +                    io:format("~nIn last_entry_at: ~n",[]),
  +                    io:format("Expected: ~p~n",[Expected]),
  +                    io:format("Observed: ~p~n~n",[Observed]),
  +                    Expected =:= Observed
  +            end;
           false ->
  -            io:format("~nResult (Should be empty): ~p~n",[Result]),
  -%            Result =:= []
               true
       end;
   postcondition(_S, _V, _Result) ->
  
positive.code:         postcondition/3, next_state/3, diff/2, sum/2, timestamp/0]).
  
  -define(DRIVER, cakedb_driver).
  
  -define(STREAMNAMES, ["tempfile", "file001", "anotherfile",
          "somefile", "binfile", "cakestream"]).
  
  
negative.code: 
  % define the commands to test
  command(S) ->
      frequency(
          [
              {9,{call,?DRIVER,append,[elements(?STREAMNAMES),list(integer(65,122))]}},
              {1,symb_call(range_query, elements(?STREAMNAMES), S#state.starttime)},
              {1,symb_call(all_since, elements(?STREAMNAMES), S#state.starttime)},
              {1,symb_call(last_entry_at, elements(?STREAMNAMES), S#state.starttime)}
          ]
      ).
  
  % define when a command is valid
  precondition(S,{call,?DRIVER,_Query,[StreamName|_OtherArgs]}) ->
      case lists:keysearch(StreamName,1,S#state.streams) of
          {value, {StreamName,Data}} ->
              case Data of
                  [] ->
                      true;
                  _ ->
                      % Make sure CakeDB had time to flush
                      timer:sleep(?TIMEOUT),
                      true
              end;
          false ->
              true
      end;
  precondition(_S, _Command) ->
      true.
  