ex6 and 7 complete and tested