refactor out of html and into driver