                 Logger.info "Received :deal_finished.\n"
                          <> "List of empls: #{inspect empls}\n"
                          <> "Task: #{task_data.task} (#{coef})"
-                updated = task_data |> TaskProto.push_other_tasks(tasks)
+                updated = task_data |> Tasks.push_remaining_tasks(tasks)
                 try_exchange(updated)
         end
     end
 
     def try_exchange task_data do
         Logger.info "try_exchange"
-        r = task_data |> TaskProto.pop_other_task
+        r = task_data |> Tasks.pop_remaining_task
         if is_nil(r) do
             Logger.info "We tried all tasks!"
             check_offers_finally(task_data)
         else
             {t, without_task} = r
-            Logger.info "Only #{length without_task.other_tasks} tasks left"
+            Logger.info "Only #{length without_task.remaining_tasks} tasks left"
             if t != self() do
                 send t, {:go_exchange, self(), without_task}
                 wait_agreement = fn itself ->

                         <> "(#{List.first task_data.employers} and"
                         <> " #{List.first other_data.employers})."
                if should_exchange?(task_data, other_data) do
                    {new, oth_new} = exchange(task_data, other_data)
                    send pid, {:go, self(), oth_new}
                    receive do
                        :done ->
                            Logger.info "Exchange finished."
                                     <> "Now me:    #{inspect new}"
                                     <> "Now other: #{inspect oth_new}"
                            check_offers_finally(new)
                    after 1_000 ->
                            Logger.info "Exchange timeout."

                    check_offers_finally(task_data)
                end
        after 2_000 ->
            job_is_done task_data
        end
    end

    def job_is_done task_data do
        coef = task_data.skill_sum / task_data.task
        Logger.info "I'm DONE."
                 <> "List of empls: #{inspect task_data.employers}\n"
                 <> "Task: #{task_data.task} (#{coef})"
    end

    def should_exchange? first, second do
        {first_new, second_new} = Tasks.exchange(first, second)

        old_disbalance = [first, second]
                        |> Enum.map(&Tasks.disbalance &1)
                        |> Enum.sum

        new_disbalance = [first_new, second_new]
                        |> Enum.map(&Tasks.disbalance &1)
                        |> Enum.sum

        new_disbalance < old_disbalance
    end

    def perfect_state _data do
