find consecutive runs and find next change functions for waves