modified again to fix some minor glitches with generators inside list comprehensions (they don't work, which makes sense)