A simplified solution for simplifying path.