pathFix() algorithm added. This seems to work--so far all tests
have passed. Should add shapefile creation step next. Refactoring
into modules after that. Some diagnostic code should be removed
or rewritten.