js refact.