Added sorting to query to ensure consistent result.