Added sorting code to a branch off of a stable version of master.
Some testing completed.