Finished assign_task method