Code for running single dataset, half done