js refactoring
resolved conflicts