Implemented task1 and task2