Refactored to not creating new scope on every state change