added test case for Average
clean up
Tree: cleanup and tests