move a part of main in init