Refactor metric reducers

Try to remove duplicate code for metrics that create single value.
I only make this pull request so you know where this is going.
I think it is important to keep different classes on the client-side so that we can have more type safety and potentially add some methods to only eg. avg in the future