regroup init funcion in main.js