anchor.diff:        {[HBQMessage | HBQRest], [DLQMessages, DLQSize]}
     end.
   
  -% push only valid messages into dlq, message is valid if it is expected
  +%% push only valid messages into dlq, message is valid if it is expected
   pushToDLQ([NNr, Msg, TSclientout, TShbqin], DLQ, Logfile) ->
     ExpectedNNr = dlq:expectedNr(DLQ),
     if
  
positive.code: -module(hbq).
  -export([start/0, start/1, hbq/3, apply_on_list/3, sort/1]).
  
  
negative.code:   werkzeug:logging(LogAtom, lists:concat(Message)),
    LogAtom.
  
  %% Used to apply a function on a list. Helper function for sorting.
  apply_on_list([H | T], X, Func) ->
    apply_on_list(T, lists:append(X, [Func(H)]), Func);
  apply_on_list([], X, _) -> X.
  
  %% Sorts messages in the HBQ
  sort(Messages) ->
    apply_on_list(lists:keysort(1, apply_on_list(Messages, [], fun list_to_tuple/1)), [], fun tuple_to_list/1).
  
  %% Inserts an error message into dlq
  insertErrorMessage(ErrorNNr, DLQ, Config) ->
    From = dlq:expectedNr(DLQ),
    ErrorMsg = "Fehlernachricht fuer Nachrichtennummern " ++ integer_to_list(From) ++ " bis " ++ integer_to_list(ErrorNNr),
    ErrorMessage = [ErrorNNr, ErrorMsg, erlang:now(), erlang:now()],
    dlq:push2DLQ(ErrorMessage, DLQ, Config).
  
  %% Handles inserting error message or doing nothing if everything is ok!
  handleFaultyHBQ([HBQMessage | HBQRest], [DLQMessages, DLQSize], Config) ->
    HBQLength = length([HBQMessage | HBQRest]),
    [NNr, _MSG, _TSclientin, _TShbqin] = HBQMessage,
  