anchor.diff:          true -> score(Query, T)
       end.
   
  +% Look up if someone is waiting to hear the result of a hashtag
   requested(Query, [{Hashtag, Requestor}|T]) ->
       if
           Hashtag == Query -> Requestor;
  
positive.code:         true -> score(Query, T)
      end.
  
  remove(_Requestor, [{null, _}]) -> [{null, {null, null}}];
  remove(Requestor, [{H, R}|T]) ->
      case Requestor == R of
  
negative.code:             end
      end.
  
  % Start crawling one hashtag per BFREQ seconds
  background_scheduler() ->
      receive
          Hashtag -> spawn(scraper, scrape, [Hashtag])
      end,
      receive
      after ?BFREQ -> background_scheduler()
      end.
  
  % Seed with initial value
  priority_scheduler() -> priority_scheduler(?NUM_PRIORITY_THREADS).
  
  % See comment on priority_scheduler(N).
  % If you've already spawned N threads, enforce a hard rate limit.
  priority_scheduler(0) -> 
      receive
      after ?PFREQ -> priority_scheduler(1)
      end;
  
  % Schedule Priority (user-initiated) scrapes. These are also rate limited.
  % However, you can basically "borrow" up to NUM_PRIORITY_THREADS worth of
  % requests, so a user won't be stuck waiting for 10 seconds if they send a few
  % requests in quick succession.
  priority_scheduler(N) ->
      receive
          Hashtag -> scraper:scrape(Hashtag),
                     priority_scheduler(N-1)
      % Enforce rate limit
      after ?PFREQ -> priority_scheduler(min_of(N+1, ?NUM_PRIORITY_THREADS))
      end.
  
  %% Helper Functions %%
  
  % Put all hashtags in the list into the background queue.
  crawl([]) -> ok;
  crawl([H|T]) ->
      whereis(background_scheduler) ! H,
      crawl(T).
  
  % Look up the score of a hashtag
  score(Query, [{Hashtag, Score}|T]) ->
      if
          Hashtag == Query -> Score;
  