Fixed the task 4 according to teacher's notes.