Added some functions to main.js