added functions to main.js