Added sorting.
Finished sorting.