Seperate common functions to single js file