refactored to use comprehension syntax