Made the list function return sorted lists