anchor.diff:      	    State
       end.
   
  -reload_mod(Mod, #hotbeam_state{beams = Beams} = State) when is_atom(Mod) -> reload_mod(lists:keyfind(Mod, #hotbeam.mod, Beams), State);
  -reload_mod(false, State) -> State;
  -reload_mod({value, #hotbeam{} = HB}, State) -> reload_mod(HB, State);
  +reload_mod(Mod, #hotbeam_state{beams = Beams} = State) when is_atom(Mod) -> 
  +    HF = fun(M, B) -> case lists:keyfind(M, #hotbeam.mod, B) of false -> undefined; #hotbeam{} = HB -> HB end end,
  +    case {loaded, HF(Mod, Beams)} of
  +        {loaded, undefined} ->
  +            S0 = #hotbeam_state{beams = NewBeams} = p_rescan_fun(Mod, State),
  +            case {new, HF(Mod, NewBeams)} of
  +                {new, undefined} -> 
  +                    ?info("unable to add ~p", [Mod]),
  +                    State;
  +                {new, #hotbeam{} = HB} -> 
  +                    reload_mod(HB, S0)
  +            end;
  +        {loaded, #hotbeam{} = HB} -> 
  +            reload_mod(HB, State)
  +    end;
   reload_mod(#hotbeam{mod = Mod} = HB, #hotbeam_state{hotload_count = HC, beams = Beams} = State) when is_atom(Mod)->
       case {sticky, code:is_sticky(Mod)} of
           {sticky, true} -> State;
  
positive.code:         {mod, _, {value, #hotbeam{beam=B,src=S,beam_time=BT,src_time=ST} = HB}} when Enable == true ->
              SrcTime = p_filetime(S),
              BeamTime = p_filetime(B),
              case {reload, SrcEnable, ST < SrcTime, BT < BeamTime} of
                  {reload, true, true, _} -> 
                      ?info("recompiling ~p", [Mod]),
                      p_lazy_load(HB#hotbeam{last = ?enow()}, State);
                  {reload, _, false, true} -> 
                      ?info("reloading ~p", [Mod]),
                      reload_mod(HB#hotbeam{last = ?enow()}, State);
                  {reload, _, _, _} -> State#hotbeam_state{beams = lists:keystore(Mod, #hotbeam.mod, Beams, HB#hotbeam{last = ?enow()})}
              end;
  
negative.code:             [
                  {beam, B},
                  {src, S},
                  {time, [{src, if is_integer(ST) -> Now - ST; true -> ST end}, {beam, if is_integer(BT) -> Now - BT; true -> BT end}]},
                  {last, Now - L}
              ]
      end.
  