added a first test. stopped global variable leak.  formatted old code.