Changes in several methods to implement the case of an empty list