We should really clean up indentation on this template. We're nesting up to 5 levels, and it's difficult to tell which block of code we're in.