Fix chords^2 execution time of removeOverlappingNotes function