Fixed failing test case.
Added ability to do file statistics.

Also streamlined some code in average module.