Move html rendering function from model to view.