MIgrating to modern javascript