refact js file first