Better sorting implemented. Sort works like a charm now.