ex4 complete and tested