Refactors the js code
Refactors the js code