ex3 complete and tested