Javascript functions to seperate js file