Added argument 'mode' to sumOver()