anchor.diff:  	<<OptType, OptLen, Content:OptLen/binary, Remain/binary>> = OptBin,
   	NewOpt = parse_sccp_opt(OptType, OptLen, Content),
   	parse_sccp_opts(Remain, [NewOpt|OptList]).
  +
   
   % Parse incoming SCCP message, one function for every message type
   parse_sccp_msgt(?SCCP_MSGT_CR, DataBin) ->
  
positive.code: gen_addr_helper(Number, Pc) when is_list(Number) ->
  	Gt = gen_gt_helper(Number),
  	gen_addr_helper(Gt, Pc).
  
negative.code: 	<<ResNatOut:1, RoutIndOut:1, GTind:4, SSNind:1, PCind:1, PCbin/binary, SSNbin/binary, GTbin/binary>>.
  
  
  encode_sccp_opt({AddrTag, AddrVal}) when AddrTag == ?SCCP_PNC_CALLED_PARTY_ADDRESS;
  					 AddrTag == ?SCCP_PNC_CALLING_PARTY_ADDRESS ->
  	AddrEnc = encode_sccp_addr(AddrVal),
  	AddrLen = byte_size(AddrEnc),
  	<<AddrTag:8, AddrLen:8, AddrEnc/binary>>;
  encode_sccp_opt({OptInt, DataBin}) when is_binary(DataBin), is_integer(OptInt) ->
  	DataBinLen = byte_size(DataBin),
  	<<OptInt:8, DataBinLen:8, DataBin/binary>>;
  encode_sccp_opt({Opt, DataBin}) when is_atom(Opt) ->
  	OptNum = atom_to_opt(Opt),
  	encode_sccp_opt({OptNum, DataBin});
  encode_sccp_opt({Opt, DataInt}) when is_integer(DataInt), DataInt =< 255 ->
  	encode_sccp_opt({Opt, <<DataInt:8>>});
  encode_sccp_opt({Opt, DataList}) when is_list(DataList) ->
  	encode_sccp_opt({Opt, list_to_binary(DataList)}).
  
  encode_sccp_opts(OptList, Filter) ->
  	FilteredList = lists:filter(fun({Tag, _Val}) -> proplists:is_defined(opt_to_atom(Tag), Filter) end, OptList),
  	e_sccp_opts(FilteredList, []).
  
  e_sccp_opts([], OptEnc) ->
  	% end of options + convert to binary
  	list_to_binary([OptEnc, ?SCCP_PNC_END_OF_OPTIONAL]);
  e_sccp_opts([CurOpt|OptPropList], OptEnc) ->
  	CurOptEnc = encode_sccp_opt(CurOpt),
  	e_sccp_opts(OptPropList, list_to_binary([OptEnc,CurOptEnc])).
  
  
  encode_sccp_msgt(?SCCP_MSGT_CR, Params) ->
  	SrcLocalRef = proplists:get_value(src_local_ref, Params),
  	{ProtoClass, PCOpt} = proplists:get_value(protocol_class, Params),
  	CalledParty = proplists:get_value(called_party_addr, Params),
  	CalledPartyEnc = encode_sccp_addr(CalledParty),
  	CalledPartyLen = byte_size(CalledPartyEnc),
  	PtrOpt = CalledPartyLen+1+1,
  	OptBin = encode_sccp_opts(Params, [credit, calling_party_addr, user_data, hop_counter, importance]),
  	<<?SCCP_MSGT_CR:8, SrcLocalRef:24/big, PCOpt:4, ProtoClass:4, 2:8, PtrOpt:8, CalledPartyLen:8, CalledPartyEnc/binary, OptBin/binary>>;
  encode_sccp_msgt(?SCCP_MSGT_CC, Params) ->
  	SrcLocalRef = proplists:get_value(src_local_ref, Params),
  	DstLocalRef = proplists:get_value(dst_local_ref, Params),
  	{ProtoClass, PCOpt} = proplists:get_value(protocol_class, Params),
  	OptBin = encode_sccp_opts(Params, [credit, called_party_addr, user_data, importance]),
  	<<?SCCP_MSGT_CC:8, DstLocalRef:24/big, SrcLocalRef:24/big, PCOpt:4, ProtoClass:4, OptBin/binary>>;
  encode_sccp_msgt(?SCCP_MSGT_CREF, Params) ->
  	DstLocalRef = proplists:get_value(dst_local_ref, Params),
  	RefusalCause = proplists:get_value(refusal_cause, Params),
  	OptBin = encode_sccp_opts(Params, [called_party_addr, user_data, importance]),
  	<<?SCCP_MSGT_CREF:8, DstLocalRef:24/big, RefusalCause:8, OptBin/binary>>;
  encode_sccp_msgt(?SCCP_MSGT_RLSD, Params) ->
  	SrcLocalRef = proplists:get_value(src_local_ref, Params),
  	DstLocalRef = proplists:get_value(dst_local_ref, Params),
  	ReleaseCause = proplists:get_value(release_cause, Params),
  	OptBin = encode_sccp_opts(Params, [user_data, importance]),
  	<<?SCCP_MSGT_RLSD:8, DstLocalRef:24/big, SrcLocalRef:24/big, ReleaseCause:8, OptBin/binary>>;
  encode_sccp_msgt(?SCCP_MSGT_RLC, Params) ->
  	SrcLocalRef = proplists:get_value(src_local_ref, Params),
  