functions.js edited for getting appid