starting js refactor