added sorting feature