Small refactoring (popup key scope optimization)