Added sorting for top number of lines