improved testability of menu.js