anchor.diff:                                               {update, {<<"b">>, ?FLAG_TYPE}, enable},
                                                {update, {<<"c">>, ?REG_TYPE}, {assign, <<"sean">>}},
                                                {update, {<<"d">>, ?MAP_TYPE},
  -                                              {update, [{update, {<<"e">>, ?COUNTER_TYPE}, {increment,5}}]}}
  +                                              {update, [{update, {<<"e">>, ?EMCNTR_TYPE}, {increment,5}}]}}
                                               ]}, a, ?MAP_TYPE:new()),
                 BinContext = ?MAP_TYPE:to_binary(?MAP_TYPE:precondition_context(Map)),
                 {struct, [_Type, _Value, {<<"context">>, JSONCtx}]} = fetch_response_to_json(set, ?MAP_TYPE:value(Map),
                                                                                              BinContext,
  -                                                                                           ?MOD_MAP),
  +                                                                                           ModMap),
                 ?assertMatch({map, {update, [{remove, {<<"a">>, ?SET_TYPE}}]}, BinContext},
  -                           update_request_from_json(map, {struct, [{<<"remove">>, <<"a_set">>}, {<<"context">>, JSONCtx}]}, ?MOD_MAP)),
  +                           update_request_from_json(map, {struct, [{<<"remove">>, <<"a_set">>}, {<<"context">>, JSONCtx}]}, ModMap)),
                              
                 %% Invalid field names
  -              ?assertThrow({invalid_field_name, <<"a_hash">>}, update_request_from_json(map, {struct, [{<<"add">>, <<"a_hash">>}]}, ?MOD_MAP)),
  -              ?assertThrow({invalid_field_name, <<"foo">>}, update_request_from_json(map, {struct, [{<<"remove">>, <<"foo">>}]}, ?MOD_MAP)),
  +              ?assertThrow({invalid_field_name, <<"a_hash">>}, update_request_from_json(map, {struct, [{<<"add">>, <<"a_hash">>}]}, ModMap)),
  +              ?assertThrow({invalid_field_name, <<"foo">>}, update_request_from_json(map, {struct, [{<<"remove">>, <<"foo">>}]}, ModMap)),
                 ?assertThrow({invalid_field_name, <<"b_blob">>}, 
                              update_request_from_json(map, {struct, 
                                                             [{<<"update">>, 
                                                               {struct, [{<<"a_map">>, 
  -                                                                       {struct, [{<<"remove">>, <<"b_blob">>}]}}]}}]}, ?MOD_MAP)),
  +                                                                       {struct, [{<<"remove">>, <<"b_blob">>}]}}]}}]}, ModMap)),
                 %% Invalid operations for maps
                 ?assertThrow({invalid_operation, {map, _}},
  -                           update_request_from_json(map, <<"increment">>, ?MOD_MAP)),
  +                           update_request_from_json(map, <<"increment">>, ModMap)),
                 ?assertThrow({invalid_operation, {map, _}},
  -                           update_request_from_json(map, {struct, [{<<"increment">>, 5}]}, ?MOD_MAP)),
  +                           update_request_from_json(map, {struct, [{<<"increment">>, 5}]}, ModMap)),
                 ?assertThrow({invalid_operation, {map, _}},
  -                           update_request_from_json(map, {struct, [{<<"add_all">>, [<<"foo">>]}]}, ?MOD_MAP)),
  +                           update_request_from_json(map, {struct, [{<<"add_all">>, [<<"foo">>]}]}, ModMap)),
                 %% Invalid operations for nested types
                 ?assertThrow({invalid_operation, {counter, _}},
                              update_request_from_json(map, 
  -                                                    {struct, [{<<"update">>, {struct, [{<<"a_counter">>, <<"poke">>}]}}]}, ?MOD_MAP)),
  +                                                    {struct, [{<<"update">>, {struct, [{<<"a_counter">>, <<"poke">>}]}}]}, ModMap)),
                 ?assertThrow({invalid_operation, {flag, _}},
                              update_request_from_json(map, 
  -                                                    {struct, [{<<"update">>, {struct, [{<<"a_flag">>, 5}]}}]}, ?MOD_MAP)),
  +                                                    {struct, [{<<"update">>, {struct, [{<<"a_flag">>, 5}]}}]}, ModMap)),
                 ?assertThrow({invalid_operation, {register, _}},
                              update_request_from_json(map, 
  -                                                    {struct, [{<<"update">>, {struct, [{<<"a_register">>, true}]}}]}, ?MOD_MAP)),
  +                                                    {struct, [{<<"update">>, {struct, [{<<"a_register">>, true}]}}]}, ModMap)),
                 ?assertThrow({invalid_operation, {set, _}},
                              update_request_from_json(map, 
  -                                                    {struct, [{<<"update">>, {struct, [{<<"a_set">>, {struct, [{<<"delete">>, <<"bar">>}]}}]}}]}, ?MOD_MAP)),
  +                                                    {struct, [{<<"update">>, {struct, [{<<"a_set">>, {struct, [{<<"delete">>, <<"bar">>}]}}]}}]}, ModMap)),
                 ?assertThrow({invalid_operation, {map, _}},
                              update_request_from_json(map, 
  -                                                    {struct, [{<<"update">>, {struct, [{<<"a_map">>, {struct, [{<<"delete">>, <<"bar">>}]}}]}}]}, ?MOD_MAP))
  +                                                    {struct, [{<<"update">>, {struct, [{<<"a_map">>, {struct, [{<<"delete">>, <<"bar">>}]}}]}}]}, ModMap))
   
         end}
       ].
  
positive.code:       end},
       {"decode map ops",
        fun() ->
                %% Simple ops
                ?assertEqual({map, {update, [{add, {<<"a">>, ?COUNTER_TYPE}}]}, undefined},
                             update_request_from_json(map, {struct, [{<<"add">>, <<"a_counter">>}]}, ?MOD_MAP)),
                ?assertEqual({map, {update, [{add, {<<"a">>, ?COUNTER_TYPE}}, {add, {<<"a">>, ?SET_TYPE}}]}, undefined},
                             update_request_from_json(map, {struct, [{<<"add">>, [<<"a_counter">>, <<"a_set">>]}]}, ?MOD_MAP)),
                ?assertEqual({map, {update, [{remove, {<<"a">>, ?COUNTER_TYPE}}]}, undefined},
                             update_request_from_json(map, {struct, [{<<"remove">>, <<"a_counter">>}]}, ?MOD_MAP)),
                ?assertEqual({map, {update, [{remove, {<<"a">>, ?COUNTER_TYPE}}, {remove, {<<"a">>, ?SET_TYPE}}]}, undefined},
                             update_request_from_json(map, {struct, [{<<"remove">>, [<<"a_counter">>, <<"a_set">>]}]}, ?MOD_MAP)),
                %% Removes get ordered before adds, multiple ops extracted
                ?assertEqual({map, {update, [{remove, {<<"a">>, ?COUNTER_TYPE}}, {add, {<<"a">>, ?SET_TYPE}}]}, undefined},
                             update_request_from_json(map, {struct, [{<<"add">>, [<<"a_set">>]}, {<<"remove">>, [<<"a_counter">>]}]}, ?MOD_MAP)),
                %% Nested updates
                ?assertEqual({map, {update, [{update, {<<"a">>, ?COUNTER_TYPE}, increment}]}, undefined},
                             update_request_from_json(map, {struct, [{<<"update">>, {struct, [{<<"a_counter">>, <<"increment">>}]}}]}, ?MOD_MAP)),
  
                ?assertEqual({map, {update, [{update, {<<"b">>, ?MAP_TYPE}, 
                                              {update, [{update, {<<"c">>, ?REG_TYPE}, {assign, <<"foo">>}}]}}]}, undefined},
  
negative.code:                                              {update, {<<"b">>, ?FLAG_TYPE}, enable},
                                               {update, {<<"c">>, ?REG_TYPE}, {assign, <<"sean">>}},
                                               {update, {<<"d">>, ?MAP_TYPE},
                                                {update, [{update, {<<"e">>, ?EMCNTR_TYPE}, {increment,5}}]}}
                                              ]}, a, ?MAP_TYPE:new()),
                ?assertEqual({struct, [
                                       {<<"type">>, <<"map">>},
  