extract build friends case procedure from train_pitf