added sorting in count