added sorting and limits.