All the code for the automated reporting