refactored metrics task to store state of previous results
new unit test for metrics task