Adding a MAX_INACTIVITY_INTERVAL and refactored timedelta() out