fix sort function to add extra lines, and then go back to entry to fill and clean it