Added sorting for dict output