simplifying implementation with list comprehension