Apply the Polyline constructor refactoring to the newslice code