smarter autogen

Change-Id: I06b8ca6db92e4c9a18c4851dca9ec87497ac7209