Refactor code from main.js to MainLevel module.