js refactor yo