match_altitudes function completed.