Refactored to not creating new scope on every state change

Already the change in the next commit pull the latest