added code for data analysis