Added Q5 solution