Added functionality for Task 3