This seems to be working to find the average