Refactor tabs.js.