Finished putting all the code for the analysis altogether.