More work on #3

Think this should finish it.  Needs tested.