Better data analysis, plotting and overall code