added generation logic for models