more refactoring js
merge conflict fix