ex1 complete and tested