I feel that this UI state stuff should be in its own file/methods somewhere instead of baked into the Renderer