added sum and average functionality
added groupBy functionality