Some code cleanup of menubar.js