more generalized data splitter