This should resolve some over-segmenting cases. Should be pretty easy to implement and will run very fast if just using mean/median waveforms. see http://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.pone.0062123#s2