added circular buffer to the integral, not helping though