Task 9. Done.
Fixed logical mistake.