Refactor of escopo.js file