cleanups, added calculation for interval with max. activity