added functionality for averages