add active state memoization