Checking in some code to find all the local maximas robustly.