Remove all unnecessary paths.