def METHOD_NAME():
  result = []
  while True:
    comm.send(rank, dest=0)
    msg = comm.recv(source=0)
    if str(msg) == 'endrun':
      break
    #receive contents for processing
    activity, act_params = msg
    if activity == "scale":
      frame_files, iparams = act_params
      from prime.postrefine import postref_handler
      prh = postref_handler()
      for frame_index, frame_file in enumerate(frame_files):
        pres, _ = prh.scale_frame_by_mean_I(frame_index, frame_file, iparams, 0, 'average')
        result.append(pres)
    if activity == "pre_merge":
      frame_results, iparams = act_params
      its = intensities_scaler()
      prep_output = its.prepare_output(frame_results, iparams, 'average')
      result.append(prep_output)
    if activity == "merge":
      batch_prep, iparams = act_params
      its = intensities_scaler()
      mdh, _, txt_out_rejection  = its.calc_avg_I_cpp(batch_prep, iparams, 'average')
      result.append([mdh, txt_out_rejection])
  return result