Fixed bug with sorting.
Now is independent from quantity of elements.