Refactor Js, change variable names