Changed script to extract data set in wide format