added question 4 code