Fix unit-test to run with requirejs

also: move SortedSet to own module