Fix the code to insert wave-segments how it says it does