updating Prob 7 solution