Improvement of the 1 and 2 subtasks of task 1