ex1 is now complete.  Just need to add comments and perhaps some re-factoring.