All this markup should be in a template function.