fixed up js file setup, removed var g for globals