Implemented task 4