Added sorting.
Merge branch 'master' into testing