code to split data