refactoring, trying to fix bug with path parsing