renamed a couple of variables to clarify that they are generator