2692 Added sorted function and tests

https://gist.github.com/dpolcyn/810aa69574c918dc93e2#file-gistfile1-txt
Unused imports.