Use itertools when possible.
Added max_items to template tags.