Added code for solutions to question 2