little simplification in peak_search