anchor.diff:  		  _ -> "Data"
   	      end,
   	    
  -    emit(["case catch decode_disp(Type,",DecWrap,") of",nl,
  -	  "  {'EXIT',{error,Reason}} ->",nl,
  -	  "    {error,Reason};",nl,
  -	  "  {'EXIT',Reason} ->",nl,
  -	  "    {error,{asn1,Reason}};",nl]),
  -    case {Erules,Return_rest} of 
  -	{ber,false} ->
  +    emit(["try decode_disp(Type, ",DecWrap,") of",nl]),
  +    case erule(Erules) of
  +	ber ->
   	    emit(["  Result ->",nl,
  -		  "    {ok,Result}",nl]);
  -	{ber,true} ->
  -	    emit(["  Result ->",nl,
  -		  "    {ok,Result,Rest}",nl]);
  -	{_,false} ->
  -	    emit(["  {X,_Rest} ->",nl,
  -		  "    {ok,X};",nl,
  -		  "  {X,_Rest,_Len} ->",nl,
  -		  "    {ok,X}",nl]);
  -	{per,true} ->
  -	    emit(["  {X,{_,Rest}} ->",nl,
  -		  "    {ok,X,Rest};",nl,
  -		  "  {X,{_,Rest},_Len} ->",nl,
  -		  "    {ok,X,Rest};",nl,
  -		  "  {X,Rest} ->",nl,
  -		  "    {ok,X,Rest};",nl,
  -		  "  {X,Rest,_Len} ->",nl,
  -		  "    {ok,X,Rest}",nl]);
  -	{uper,true} ->
  -	    emit(["  {X,{_,Rest}} ->",nl,
  -		  "    {ok,X,Rest};",nl,
  -		  "  {X,{_,Rest},_Len} ->",nl,
  -		  "    {ok,X,Rest};",nl,
  -		  "  {X,Rest} ->",nl,
  -		  "    {ok,X,Rest};",nl,
  -		  "  {X,Rest,_Len} ->",nl,
  -		  "    {ok,X,Rest}",nl])
  +		  case Return_rest of
  +		      false -> "    {ok,Result}";
  +		      true ->  "    {ok,Result,Rest}"
  +		  end,nl]);
  +	per ->
  +	    emit(["  {Result,Rest} ->",nl,
  +		  case Return_rest of
  +		      false -> "    {ok,Result}";
  +		      true ->  "    {ok,Result,Rest}"
  +		  end,nl])
       end,
  -    emit(["end.",nl,nl]),
  +    emit([try_catch(),nl,nl]),
   
       gen_decode_partial_incomplete(Erules),
   
  
positive.code:     end,
      emit([nl]),
      emit({nl,nl}).
  
  gen_info_functions(Erules) ->
      emit(["encoding_rule() -> ",
  
negative.code: 		  ["  Bytes ->",nl,
  		   "    {ok,",BytesAsBinary,"}",nl]
  	  end,
  	  try_catch(),nl,nl]),
  
      Return_rest = lists:member(undec_rest,get(encoding_options)),
      Data = case {Erules,Return_rest} of
  