Refactoring state management to allow getting state from 2 pages at once