switch out from arbitrary variables to a structured object, clean up the html muchly by introducing a 'model'