Added sorting.
Better sorting and resizing.