added path sorting