TODO: A linear search might be more efficient than doing the full sort.