Add functions to find the gap valley.