refactor internal/v5/menu code