just set the code back to the point where sum_calculation of functions dont work. Seems that numCat needs to be passed as pointer will fix it tomorrow