Now catches division by zero error.
History tables can now be generated less frequently rather than every report cycle.