replaced size() with __len__ built-in changed self.__components = components to self.__components = list(components) replacing for loops with list comprehension allowing -ve indexing in component() and changeComponent()