             case .female: self.sexInBoolean = false
         }
         
-        self.bloodPressureMeasurements = bloodPressureMeasurements
+        self.bloodPressureMeasurementsSorted = bloodPressureMeasurements.sorted {
+            return $0.measurementDate < $1.measurementDate
+        }
     }
     
     // Encoder used to store a patient.

        static let birthDate = "birthDate"
        static let heightInMeters = "heightInMeters"
        static let sexInBoolean = "sexInBoolean"
        static let bloodPressureMeasurements = "bloodPressureMeasurements"
    }
    
    // Create a new patient

    var birthDate: Date
    var heightInMeters: Float
    private var sexInBoolean: Bool
    private var bloodPressureMeasurementsSorted: [BloodPressureMeasurement]
    public var bloodPressureMeasurements: [BloodPressureMeasurement] {
        get {
            return self.bloodPressureMeasurementsSorted
        }
        
        set(newBloodPressureMeasurements) {
            self.bloodPressureMeasurementsSorted = newBloodPressureMeasurements.sorted {
                return $0.measurementDate < $1.measurementDate
            }
        }
    }
    
    public var sex: Patient.Sex {
        get {
