Refactor part 2: removed redundant list variable