adds code to js duplicated code refactor lab