Improve spline overlap handling.

This follows up on #1485 and attempts to address #1505.

@tshinnic, @mskala, can you test and report anything that's still broken?

I needed to move this up in order to use it in several functions.