Error messaging
Don't write an average function twice