moved necessary code to summation class, still needs to be properly fixed.