updated problem 4.  Think I have a working solution