full working version with .js file config