Moved generation logic to a new module