Let's try to re-factor this so there isn't so much logic in the view. I can help.