reworked using new generator version and redid some logic.