solution to problem 7 added