Fix: bug that could lead to incorrect bounding boxes
Simpler function for simplifying paths