almost done average func Todo compute part