Use generator expressions, not list comprehensions
Configuration is now passed as parameters

Before this commit the configuration was stored in global variables.
This is obviously a bad way to do it so instead they are passed as
parameters