please rewrite this part using list comprehensions