Added code for exercise 2 hw3