remove redudant code and alert in main.js