Fix imports
Correct definition of Array-version of sorted
Add test
Make things immutable
Move TODO