Implemented task 3.