anchor.diff:  find({_, _, _, _, Right}, Key) ->
   	find(Right, Key).
   
  --spec insert(Tree :: treap(), Key :: term(), Item :: term()) -> treap().
  -%% @equiv insert(Tree, Key, erlang:system_time(), Item)
  -insert(Tree, Key, Item) ->
  -	insert(Tree, Key, erlang:system_time(), Item).
  +-spec insert(Tree1, Key, Item) -> Tree2
  +	when
  +		Tree1 :: treap(),
  +		Key :: term(),
  +		Item :: term(),
  +		Tree2 :: treap().
  +%% @equiv insert(Tree1, Key, erlang:system_time(), Item)
  +insert(Tree1, Key, Item) ->
  +	insert(Tree1, Key, erlang:system_time(), Item).
   
  --spec insert(Tree :: treap(), Key :: term(),
  -		Time :: erlang:system_time(), Item :: term()) -> treap().
  -%% @doc Inserts `Key' with value `Item' into `Tree'.
  -%% 	Returns a new `Tree'.
  -insert({Left, Key, _, _, Right} = _Tree, Key, Time, Item) ->
  +-spec insert(Tree1, Key, Time, Item) -> Tree2
  +	when
  +		Tree1 :: treap(),
  +		Key :: term(),
  +		Time :: pos_integer(),
  +		Item :: term(),
  +		Tree2 :: treap().
  +%% @doc Inserts `Key' with value `Item' into `Tree1'.
  +%% 	Returns a new `treap()' in `Tree2'.
  +insert({Left, Key, _, _, Right} = _Tree1, Key, Time, Item) ->
   	{Left, Key, Time, Item, Right};
   insert({Left, K, T, I, Right}, Key, Time, Item) when Key < K ->
   	rebalance({insert(Left, Key, Time, Item), K, T, I, Right});
  
positive.code: %%% @reference <a href="http://arxiv.org/pdf/cs/0505038v1.pdf">
  %%% 	Efficient Management of Short-Lived Data</a>
  %%% @todo Expire during operations?
  %%%---------------------------------------------------------------------
  %%%
  -module(ephemeral_trees).
  
negative.code: insert(undefined, Key, Time, Item) ->
  	{undefined, Key, Time, Item, undefined}.
  
  -spec remove(Tree1, Key) -> Tree2
  	when
  		Tree1 :: treap(),
  		Key :: term(),
  		Tree2 :: treap().
  %% @doc Remove `Key' from `Tree1'.
  %% 	Returns a new `treap()' in `Tree2'.
  remove({_, Key, _, _, _} = Tree1, Key) ->
  	percolate(Tree1);
  remove({Left, K, T, I, Right}, Key) when Key < K ->
  	{remove(Left, Key), K, T, I, Right};
  remove({Left, K, T, I, Right}, Key) ->
  	{Left, K, T, I, remove(Right, Key)}.
  	
  -spec expire(Tree1, Time) -> Tree2
  	when
  		Tree1 :: treap(),
  		Time :: pos_integer(),
  		Tree2 :: treap().
  %% @doc Efficiently emove every item older than `Time'.
  %% 	Returns a new `treap()' in `Tree2'.
  expire({_, K, T, _, _} = Tree1, Time) when T < Time ->
  	expire(remove(Tree1, K), Time);
  expire(Tree, _Time) ->
  	Tree.
  
  %%%
  %%% internal functions
  %%% 
  
  -spec rebalance(Tree1) -> Tree2
  	when
  		Tree1 :: treap(),
  		Tree2 :: treap().
  %% @doc Rebalance through order-preserving node rotations.
  %% @private
  rebalance({{S1, K, T, I, S2}, Key, Time, Item, S3} = _Tree1) when Time > T ->
  	{S1, K, T, I, {S2, Key, Time, Item, S3}};
  rebalance({S1, Key, Time, Item, {S2, K, T, I, S3}}) when Time > T ->
  	{{S1, Key, Time, Item, S2}, K, T, I, S3};
  rebalance(Tree) ->
  	Tree.
  
  -spec percolate(Tree1) -> Tree2
  	when
  		Tree1 :: treap(),
  		Tree2 :: treap().
  %% @doc Rebalancing node rotations during removal.
  %% @private
  percolate({undefined, _, _, _, undefined} = _Tree1) ->
  	undefined;
  percolate({undefined, K, T, I, {Lr, Kr, Tr, Ir, Rr}}) ->
  	{Lr, Kr, Tr, Ir, percolate({undefined, K, T, I, Rr})};
  