Implemented task2c.