more logic for autogen