refactor break out html related things from index.js