added code to split data for running in parallel