refactor context menu and modal