added some functions in main.js