move some tag processing to the model