Add global variable to be able to return average at the end