simplify problem 7
changed problem 8 queries after hint from dr. s.