Removing useless paths