made a splits function with scanl