Fix namespace selection.  Put back some static variables that were needed.  Test output now matches before code refactoring.