small Js refactoring removing not needed code