Better way to return sorted lines