anchor.diff:      clean_fetch(Params, []).
   
   clean_fetch([], Acc) ->
  -    {fetch, Acc};
  +    {fetch, lists:reverse(Acc)};
   clean_fetch([<<"UID">>, Uid | Rest], Acc) ->
       clean_fetch(Rest, [{uid, Uid} | Acc]);
   clean_fetch([<<"FLAGS">>, Flags | Rest], Acc) ->
  
positive.code: 
  %% response() is passed into the applicable commands dispatch fun
  -type response() :: {'*' | '+' | 'OK' | 'NO' | 'BAD', imap_term()}.
  
  %% cmd() specifies a valid command that can be issued via call or cast
  -type cmd() :: {login, auth()}
  
negative.code: -ifdef(TEST).
  -include_lib("eunit/include/eunit.hrl").
  
  -define(FETCH, {'*',[37,<<"FETCH">>,
                       [<<"UID">>,37,<<"BODY">>,
                        [[{string,<<"TEXT">>},
                          {string,<<"PLAIN">>},
                          [{string,<<"CHARSET">>},{string,<<"utf-8">>}],
                          nil,nil,
                          {string,<<"QUOTED-PRINTABLE">>},
                          87,5],
                         [{string,<<"TEXT">>},
                          {string,<<"HTML">>},
                          [{string,<<"CHARSET">>},{string,<<"utf-8">>}],
                          nil,nil,
                          {string,<<"QUOTED-PRINTABLE">>},
                          850,11],
                         {string,<<"ALTERNATIVE">>}],
                        <<"ENVELOPE">>,
                        [{string,<<"Thu, 24 Apr 2014 22:16:08 -0700">>},
                         {string,<<"never">>},
                         [[{string,<<"John Doe">>},
                           nil,
                           {string,<<"john">>},
                           {string,<<"gmail.com">>}]],
                         [[{string,<<"John Doe">>},
                           nil,
                           {string,<<"john">>},
                           {string,<<"gmail.com">>}]],
                         [[{string,<<"John Doe">>},
                           nil,
                           {string,<<"john">>},
                           {string,<<"gmail.com">>}]],
                         [[nil,nil,
                           {string,<<"dispatchonme">>},
                           {string,<<"gmail.com">>}]],
                         nil,nil,nil,
                         {string,<<"<etPan.5359ef98.ded7263.112@Thomass-MacBook-Pro.local>">>}],
                        <<"FLAGS">>,[],<<"INTERNALDATE">>,
                        {string,<<"25-Apr-2014 05:16:11 +0000">>},
                        <<"RFC822.SIZE">>,3856]]}).
  
  
  -define(ADDRESSES, [[{string,<<"John Doe">>},
                       nil,
                       {string,<<"john">>},
                       {string,<<"gmail.com">>}],
                      [{string,<<"Jane Doe">>},
                       nil,
                       {string,<<"jane">>},
                       {string,<<"gmail.com">>}]]).
  
  %% Clean
  clean_test_() ->
      [clean_address_assertions(),
       clean_assertions()].
  
  clean_address_assertions() ->
      [?_assertEqual([{address, [{name, <<"John Doe">>}, {email, <<"john@gmail.com">>}]},
                      {address, [{name, <<"Jane Doe">>}, {email, <<"jane@gmail.com">>}]}],
                     clean_addresses(?ADDRESSES))].
  
  clean_assertions() ->
      [?_assertMatch({fetch, [{uid, 37},
                              {body, _},
                              {envelope, _},
                              {flags, []},
                              {internaldate, <<"25-Apr-2014 05:16:11 +0000">>},
                              {rfc822size, 3856}]},
                     clean(?FETCH))].
  
  
  %% Commands
  cmd_test_() ->
      [?_assertEqual([<<"UID">>, <<"FETCH">>, <<"1:9">>, <<"full">>],
  