Refactor tabl html into templates that are controlled by the model.