Refactor: replace list comprehension with function call