Fixed up sorting.

Fixed up sorting! Everything is done except UML! :D