changed template nesting so next_to_matrix does not show if no results