refactor_final.js