refactor for popup menu