refactor main and create sb_controller/menus.js