New method to sort magnitudes. --Juan