Solution to Q9 added