Added sorting to results (helps for bar graphs