Only generate if necessary