Speed up scanbeam traversal

Scanbeam was a list of unique long kept sorted at each insertion.
Keeping it sorted is a O(n2) process.
This use a set instead where the process is O(nlog(n)).