First iteration of the data analysis script - full tidying and summarising