Yeah, as I've been watching that section grow, I've been becoming uncomfortable with that kind of logic being in the view. Sometimes it makes sense, but I think in this case, some of it can be pushed into the model and then probably a view helper can do the logic and spit out the necessary elements. I can take another pass at this and clean it up a bit.