flatten-path and its tests added