update templates to display margin and sort by rank